﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MVCT9.Models;

namespace MVCT9.Controllers
{
    public class DeomController : Controller
    {
        // GET: Deom
        //首页 所有人都能访问
        public ActionResult Index()
        {
            return View();
        }
        //系统管理员登录，所有人都鞥访问
        public ActionResult Syslogin(Sysuser sysuser)
        {
            if (ModelState.IsValid)
            {
                using (fashionshoppingDBEntities db = new fashionshoppingDBEntities())
                {
                    Sysuser login = db.Sysuser.FirstOrDefault(s => s.username == sysuser.username && s.pwd == sysuser.pwd);
                    if (login != null)
                    {
                        return RedirectToAction("Sysindex");

                    }
                    else
                    {
                        ModelState.AddModelError("", "姓名或密码错误");
                    }
                }
            }
          
            return View();
        }

        //登陆后才能访问
        public ActionResult Sysindex()
        {
            return View();
        }
    }
}